/*
 * @Author: 孙大大
 * @Date: 2022-03-07 09:32:27
 * @LastEditTime: 2022-03-08 14:49:17
 * @FilePath: \toutiao\src\router\index.js
 */
import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "Layout",
    component: () => import("@/views/layout"),
    children: [
      {
        path: "", // 默认子路由
        name: "Home",
        component: () => import("@/views/home"),
      },
      {
        path: "/qa",
        name: "Qa",
        component: () => import("@/views/qa"),
      },
      {
        path: "/videos",
        name: "Videos",
        component: () => import("@/views/videos"),
      },
      {
        path: "/my",
        name: "My",
        component: () => import("@/views/my"),
      },
    ],
  },
  {
    path: "/login",
    name: "LoginIndex",
    component: () => import("@/views/login"), // 路由懒加载
  },
];

const router = new VueRouter({
  routes,
});

export default router;
